import request from '/@/utils/request';
// 店铺仓库
export function getStoreList() {
	return request({
		url: '/admin/sysStore/storeList',
		method: 'post',
	});
}

// 出库单分页列表
export const outboundPage = (data: any) => {
	const { current, size, ascs, descs } = data;
	const params = { current, size, ascs, descs };
	return request({
		url: `/wms/outbound/page`,
		method: 'post',
		params,
		data,
	});
};

// 新增出库单
export function saveOutbound(data) {
	return request({
		url: '/wms/outbound',
		method: 'post',
		data
	});
}

// 通过id查询出库单
export function getOutboundDetail(id) {
	return request({
		url: `/wms/outbound/${id}`,
		method: 'get'
	});
}

// 修改出库单
export function editOutbound(data) {
	return request({
		url: '/wms/outbound',
		method: 'put',
		data
	});
}
// 提交
export function submitOutbound(data) {
	return request({
		url: '/wms/outbound/submit',
		method: 'put',
		data
	});
}

// 获取拣货列表
export function pickOutbound(id) {
	return request({
		url: `/wms/outbound/pick/list/${id}`,
		method: 'get',
	});
}

// 作废
export function cancelOutbound(id) {
	return request({
		url: `/wms/outbound/cancel/${id}`,
		method: 'put',
	});
}
// 获取拣货批次和库位列表
export function outboundPickBatch(params) {
	return request({
		url: `/wms/outbound/pick/batch/${params.id}?skuId=${params.skuId}`,
		method: 'get',
	});
}
// 完成拣货
export function completePick(data) {
	return request({
		url: '/wms/outbound/completePick',
		method: 'post',
		data
	});
}
// 批量拣货 
export function batchPick(data) {
	return request({
		url: '/wms/outbound/batch/pick',
		method: 'post',
		data
	});
}
// 批量装箱
export function batchCompletePack(data,isBatch) {
	return request({
		url: `/wms/outbound/batchCompletePack/${isBatch}`,
		method: 'post',
		data
	});
}
// 完成装箱 
export function completePack(data) {
	return request({
		url: '/wms/outbound/completePack',
		method: 'post',
		data
	});
}

// 导出
export function exportOutbound(data) {
	return request({
		url:  '/wms/outbound/export',
    method: 'post',
    data,
	});
} 

// 批量出库
export function batchOutbound(data) {
	return request({
		url:  '/wms/outbound/batchOutbound',
    method: 'post',
    data,
	});
} 

export const getDicts = (type: String) => {
	return request({
		url: `/admin/dict/type/${type}`,
		method: 'get',
	});
};
export function getCompanyTeamTree(params) {
	return request({
		url: '/admin/companyTeam/tree',
		method: 'get',
		params,
	});
}

// 仓库树形结构
export function getwhTree(params) {
	return request({
		url: '/wms/warehouse/whTree',
		method: 'get',
		params,
	});
}
// 备货区域
export function sysStockArea() {
	return request({
		url:  '/admin/sysStockArea/list',
    method: 'get',
	});
} 

 
export const stockSkuList = (data: any) => {
	const { current, size, ascs, descs } = data;
	const params = { current, size, ascs, descs };
	return request({
		url: `/wms/transferOrder/stockSku`,
		method: 'post',
		params,
		data,
	});
};
// 通过业务id查询业务流程信息
export function getLatestByBusId(params) {
	return request({
		url: '/wms/flow/getLatestByBusId',
		method: 'get',
		params,
	});
}